package com.xxl.job.kettle.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxl.job.kettle.core.entity.KQuartz;
import com.xxl.job.kettle.core.mapper.KQuartzMapper;
import com.xxl.job.kettle.core.service.KQuartzService;
import org.springframework.stereotype.Service;

/**
 * 实现功能：
 *
 * @author 作者[zk]
 * @version 1.0.00  2022-11-29 17:43
 */
@Service
public class KQuartzServiceImpl extends BaseServiceImpl<KQuartzMapper, KQuartz> implements KQuartzService {

    public Page<KQuartz> findListByPage(KQuartz quartz, Integer page, Integer rows) {
        QueryWrapper<KQuartz> queryWrapper = new QueryWrapper<>();
        if (quartz != null) {
            queryWrapper.orderByDesc("edit_time");
            queryWrapper.like("QUARTZ_DESCRIPTION", quartz.getQuartzDescription());
        }
        Page<KQuartz> result = baseMapper.selectPage(new Page<>(page, rows), queryWrapper);
        return result;
    }
}
